package com.example.teatea.controller;

import com.example.teatea.dao.FinishOrder;
import javafx.event.ActionEvent;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.stage.Stage;

import java.net.URL;
import java.util.ResourceBundle;

public class SettleController implements Initializable {
    public Label oldPrice;
    public Label newPrice;
    public Button sureBt;

    public void toSure(ActionEvent actionEvent) {
        new FinishOrder().finishOrder(SeatController.nowSeat);
        Stage stage = (Stage) sureBt.getScene().getWindow();
        stage.close();
    }

    @Override
    public void initialize(URL url, ResourceBundle resourceBundle) {
        oldPrice.setText(String.valueOf(OrderListController.sum));
        if(!SettleAccountController.p.equals("")) newPrice.setText(String.valueOf(OrderListController.sum * 0.8));
        else newPrice.setText(oldPrice.getText());
    }
}
